package com.android.hq.ganktoutiao.ui.fragment;

import com.android.hq.ganktoutiao.data.GanShiTuItem;
import com.android.hq.ganktoutiao.data.GanYunGuiZhouItem;
import com.android.hq.ganktoutiao.data.GankItem;
import com.android.hq.ganktoutiao.data.bean.GanYunGuiZhouRespone;
import com.android.hq.ganktoutiao.network.CallBack;
import com.android.hq.ganktoutiao.network.RequestManager;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/5/8.
 */
public class GanYunGuiZhouFragment extends BaseFragment {
    @Override
    public void updateData() {
        RequestManager.getInstance().getDayYunGuiZhou(new CallBack<GanYunGuiZhouRespone>() {
            @Override
            public void onSuccess(GanYunGuiZhouRespone ganYunGuiZhouRespone) {
                mRefreshLayout.setRefreshing(false);
                ArrayList<GankItem> list  = new ArrayList<GankItem>();
                GanYunGuiZhouItem t = ganYunGuiZhouRespone.t;
                List<GanYunGuiZhouItem> list1 = t.news;
                list.addAll(list1);
                mAdapter.updateData(list);
                updateSuccess(list.isEmpty());
            }

            @Override
            public void onFail() {
                mRefreshLayout.setRefreshing(false);
                updateError();

            }
        });
    }

    @Override
    public void loadMore() {

    }

    @Override
    public boolean isEnablePullRefresh() {
        return true;
    }

    @Override
    public boolean isEnableLoadingMore() {
        return true;
    }

    @Override
    public boolean isEnableRefreshOnViewCreate() {
        return true;
    }
}
